package com.jeesite.common.responseReturn.web;

import com.jeesite.common.mapper.JsonMapper;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Render {
	/**
	 * 客户端返回JSON字符串
	 * @param response
	 * @param object
	 * @return
	 */
	public static String renderString(HttpServletResponse response, Object object) {
		try {
			response.reset();
	        response.setContentType("application/json");
	        response.setCharacterEncoding("utf-8");
			response.getWriter().print( JsonMapper.toJSON(object));
			return null;
		} catch (IOException e) {
			return null;
		}
	
	}
}
